]> permondes.de Git - Analog_Engine.git/blob - scripts/TP1 04.12 Harmonic Oscillator.AESL
Application Gravity
[Analog_Engine.git] / scripts / TP1 04.12 Harmonic Oscillator.AESL
1 IDENTIFICATION DIVISION
2 PROGRAM-ID HarmonicOscillator
3 VERSION 20240201
4 COMMENT A mass m is subject to a force F=-k*r.
5 COMMENT What is the trajectory if the mass starts at position (a,0,0)?
6 COMMENT How much time does it take to pass through zero?
7 COMMENT What is the trajectory if it starts at (a,0,0) with velocity (0,v0,0)?
8 COMMENT m*x'' = -k*x
9 COMMENT m*y'' = -k*y (z can be set to 0).
10
11 ENVIRONMENT DIVISION
12 ENGINE Anabrid-THAT
13 TIMEBASE 1ms
14 REQUIRES COEFFICIENT 4, INTEGRATOR 4, INVERTER 2
15
16 DATA DIVISION
17 OUTPUT OUTPUT.X x
18 OUTPUT OUTPUT.Y y
19 COEFFICIENT.1 A # (a,0,0)
20 COEFFICIENT.2 K/M_x # k/m for x
21 COEFFICIENT.3 V0 # (0,v0,0)
22 COEFFICIENT.4 K/M_y # k/m for y, identical to k/m for x
23
24 PROGRAM DIVISION
25 -1 -> COEFFICIENT.A -> -a # has to be negative because x' is negative
26 +1 -> COEFFICIENT.V0 -> v0 # has to be positive because y'' is positive
27
28 x'' -> INTEGRATOR -> -x'
29 -x', IC:-a -> INTEGRATOR -> x
30 x -> COEFFICIENT.K/M_x -> k/m*x
31 k/m*x -> INVERTER -> -k/m*x = x''
32
33 y'', IC:v0 -> INTEGRATOR -> -y'
34 -y' -> INTEGRATOR -> y
35 y -> COEFFICIENT.K/M_y -> k/m*y
36 k/m*y -> INVERTER -> -k/m*y = y''
37
38 OPERATION DIVISION
39 MODE REPEAT
40 OP-TIME 100 ms